<template>
	<section>
	 <!--工具条-->
    <!-- <el-col :span="24" class="toolbar" style="padding-bottom: 0px;">
      <el-form :inline="true" :model="filters">
        <el-form-item>
          <el-input v-model="filters.search" placeholder="鉴赏ID"></el-input>
        </el-form-item>
        <el-form-item>
          <el-button type="primary" v-on:click="getappreciaterecord">查询</el-button>
        </el-form-item>
      </el-form>
    </el-col> -->
		<el-table :data="appreciateList" v-loading="loading" stripe style="width: 100%;text-align: center;">
		    <el-table-column header-align="center" prop="taskId" label="鉴赏ID" width="120">
		    </el-table-column>
		    <el-table-column header-align="center" prop="name" label="鉴定品类">
		    </el-table-column>
		    <el-table-column header-align="center" prop="realName" label="鉴定专家" width="200">
    		</el-table-column>
    		<el-table-column header-align="center" prop="createTime" label="鉴定时间" width="200">
		    </el-table-column>
		    <el-table-column header-align="center" prop="price" label="金额" width="80">
		    </el-table-column>
		    <el-table-column header-align="center"  label="操作" width="120">
		    	<template scope="scope">
		    		 <el-button size="small" @click="lookDetails(scope.$index, scope.row)">查看详情</el-button>
		    	</template>
		    </el-table-column>
  		</el-table>
  		<!-- 分页 -->
  		<el-col :span="24" class="toolbar">
	      <el-pagination layout="prev, pager, next" @current-change="pageChange" :page-size="num" :total="total" style="float:right;">
	      </el-pagination>
	      <div class="all">总计<span class="total">{{total}}</span>条记录</div>
	    </el-col>
	</section>
</template>

	<script>
	import { sendData, cutString } from "../../api/api";
		export default{
			data(){
				return{
					 filters: {
			          search: ''
			        },
					loading:false,
					appreciateList:[],
					total:0,
					page: 1,
					num:20		
			}
		},
			methods: {
				getappreciaterecord(){
					let para = this.filters.search;
			          if (para!==""&&isNaN(para)) {
			             this.$message({
			              message: "请输入正确的鉴赏ID",
			              type: "error"
			            });
			          return
			          }
					let id=Number(sessionStorage.getItem("memberID"))
					this.loading=true
					let page=Number(this.page)
					let params=sendData({url: "user/record",msg: {id:id,pgNo:page,num:this.num}})
					this.$http.get(params.baseURL,{params:params.params}).then(res=>{
						var res=cutString(res.bodyText)
						console.log(res)
						 res.msg.rows.map(function(v,i){
									v.createTime=v.createTime.slice(0,19)
									v.price=v.price/100
				      })
				          console.log(res.msg.total)
						if (res.msg.total>1) {
				          	sessionStorage.setItem('total', JSON.stringify(res.msg.total))
				          	this.total=res.msg.total
				          }
						this.appreciateList=res.msg.rows
						this.loading=false
				
					})
				},
				// 查看详情
				lookDetails(index,row){
      		window.open("./static/preview/appreciateDetails.html?id="+row.taskId+'&category='+row.name+"&expert="+row.realName)
				},
				// 分页
				pageChange(val){
					this.total=JSON.parse(sessionStorage.getItem('total'))
					this.page=val
        			this.getappreciaterecord();
        			return
				}
			},
			mounted() {
				console.log("鉴赏记录组件")
			    this.getappreciaterecord();
			}
		}

	</script>	
<style scope>
	.all{
  font-size: 16px;
  line-height: 32px;
  color: #666
}
.total{
    padding:0 5px;
    color: #52BAE9;
  }
</style>



